package com.example.everying.mapper.statistics;/*
 * 项目名称: everything
 * 文件名: UserStatisticMapper
 * 作者: 张泽阳
 * 日期: 2025/7/7
 * 描述:
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.everying.model.entity.statistics.SystemActivityStats;
import com.example.everying.model.entity.statistics.UserSession;
import com.example.everying.model.vo.statistics.GetLoginCountVo;
import com.example.everying.model.vo.statistics.GetLoginDurationVo;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

public interface UserSessionMapper extends BaseMapper<UserSession> {
    int updateLastTimeUserSessionByUserId(@Param("userSession") UserSession userSession);

    List<String> getUserIdsByTime(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    int getStatCohortCount(@Param("statDate") LocalDate statDate, @Param("cohortDate") LocalDate cohortDate);

    List<String> getDistinctUsersByDate(@Param("date") LocalDate date);

    List<SystemActivityStats> getUserActiveTime(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);

    List<GetLoginCountVo> getLoginCount(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);

    BigDecimal getRr1(@Param("statDate") LocalDate statDate);

    BigDecimal getRr7(@Param("statDate") LocalDate statDate);

    List<SystemActivityStats> getOnlineUserCount(@Param("starTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    BigDecimal conversionStatistics();

    BigDecimal completionRate();

    BigDecimal totalAmount();

    BigDecimal recurrentRate();

    BigDecimal repurchaseRate();

    List<GetLoginCountVo> getUserLoginCount(@Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime, @Param("userId") String userId);

    List<GetLoginDurationVo> getUserLoginDuration(@Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime, @Param("userId") String userId);

    UserSession getUserSessionByUserId(@Param("userId") String userId);

    List<String> getTopTenArticle(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
